Public Class modRubro

    Private idr As Integer
    Private porcentInicial, porcentajeActual As Double
    'porcentaje del rubro inicial, porcentaje actual del plan

    Public Sub llenar(ByVal pnum As Integer, ByVal pnom As String, ByVal ptip As String, ByVal pex As String, ByVal pactual As Double, ByVal pporcent As Double)
        porcentajeActual = pactual
        porcentInicial = pporcent
        Me.porcentje.Text = pporcent
        nombrerubro.Text = pnom
        If Equals(ptip, "individual") Then
            Radioindi.Checked() = True
        Else
            Radiogrupo.Checked() = True
        End If
        If Equals(pex, "Extra") Then
            Checkextra.Checked() = True
        End If
        idr = pnum
    End Sub

    Private Sub modRobro_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub mensaje_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub cancel2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Close()
    End Sub

    Private Sub modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim gest As capaNegocios.Gestor
        gest = capaNegocios.Gestor.instanciar
        Dim rubro As String = nombrerubro.Text
        Dim porcentaje As String = porcentje.Text
        'porcentaje nuevo del rubro
        Dim tipo As Boolean = True
        Dim extra As Boolean = False
        If Radiogrupo.Checked Then
            tipo = False
        End If
        If Checkextra.Checked Then
            extra = True
        End If
        Try
            gest.modificarRubro(idr, rubro, porcentaje, tipo, extra, porcentajeActual, porcentInicial)
            MessageBox.Show("Rubro Modificado", "Confirmacion", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error en formato", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Me.DialogResult = Windows.Forms.DialogResult.None
        End Try
    End Sub
End Class